<?php
/*------------------------------------------
* @AUTHOR: TANDAT @EMAIL:tidusvn05@gmail.com
* @PHONE: +84933731173
* -----------------------------------------*/
//set error report

error_reporting(E_ALL|E_STRICT);
ini_set('display_errors','on');
date_default_timezone_set('Asia/Bangkok');

//set include path
set_include_path('.' . PATH_SEPARATOR . './library/' . PATH_SEPARATOR . './application/models' . PATH_SEPARATOR . './application/modules' . PATH_SEPARATOR . './application/layouts' . PATH_SEPARATOR . './application/common' . PATH_SEPARATOR . get_include_path());
define('APPLICATION_PATH', realpath(dirname(__FILE__) . '/application')); 



//include Loader file
require_once 'Zend/Loader/Autoloader.php';
$autoloader = Zend_Loader_Autoloader::getInstance();
$autoloader->registerNamespace('D_');
$autoloader->setFallbackAutoloader(true);



Zend_Session::start();

$config = new Zend_Config_Ini('./application/configs/config.ini', 'development');
$registry = Zend_Registry::getInstance();
$registry->set('config', $config);

// init db cassandra
//D_Cassandra_Abstract::factory($config->db);
// init db mysql
$db = Zend_Db::factory($config->db);
$db->getProfiler()->setEnabled(true);
Zend_Db_Table::setDefaultAdapter($db);

//ROOT_URL
defined('ROOT_URL')||define('ROOT_URL',$config->rooturl);
//Define pageing 
define('COUNT_PER_PAGE',5);
//config logger
$writer = new Zend_Log_Writer_Stream('./log/development.txt');
$logger = new Zend_Log($writer);
Zend_Registry::set('logger', $logger);


//
// Khai bao
	$translate = new Zend_Translate('Array', APPLICATION_PATH . '/languages/en.php', 'en_US');
	// Them mot translate nua
	$translate->addTranslation( APPLICATION_PATH . '/languages/vi.php', 'vi_VN');
	// Dat vi_VN la translate mac dinh, ngoai ra co the dung en_US
	$translate->setLocale('vi_VN');
	Zend_Registry::set('Zend_Translate', $translate);


$layout=Zend_Layout::startMvc(array('layoutPath' => './application/layouts'));
$layout->getView()->addHelperPath('D/Helper', 'D_Helper');

$front = Zend_Controller_Front::getInstance();
$front->setControllerDirectory(array('default' => './application/controllers'));


$front->throwExceptions(true);
$front->dispatch();

// Multi language
		
		